package com.ftg.learn.spring;

/**
 * @author kangjx
 * @createTime 2022/11/29
 */
public class SpringDemo {

    //ioc功能模拟
    public static void main(String[] args) {
        MySpringFactory beaFactory = new MyClassPathApplicationContext("/home/kangjx/workspace/java/back07/target/classes/myspringapplication.xml");
        //按名称装配 bean id name
//        Cat cat = (Cat) beaFactory.getBean("cat");
//        cat.setColor("red");
//
//        System.out.println(cat.getColor());
        //按照类型装配
        Cat cat = beaFactory.getBean(Cat.class);
        cat.setColor("RED");
        System.out.println(cat.getColor());
        //通过反射获取  Cat

//        装配模式当中的按类型装配 ，你要取得的类型，有可能会在容器里面存在多个，那么这时间 没有办法 明确赋值
    }

}
